﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Ecng.Xaml;


namespace Sample.StartTrading
{
    /// <summary>
    /// Логика взаимодействия для RoboViewerBasic.xaml
    /// </summary>
    public partial class RoboViewerBasic : Window
    {
 //       private readonly SecuritiesWindow _securitiesWindow = new SecuritiesWindow();
 //       private readonly SynchronizedDictionary<Security, QuotesWindow> _quotesWindows = new SynchronizedDictionary<Security, QuotesWindow>();
        private readonly SelectedRobot _selectedRobot = new SelectedRobot();
        private readonly CreateRobot _createRobot = new CreateRobot();
   //     private readonly OpenRobot _openRobot = new OpenRobot();

  //      public static string OpenRobotFileName;

        public RoboViewerBasic()
        {
            InitializeComponent();
            _selectedRobot.MakeHideable();
            _createRobot.MakeHideable();
      //     _openRobot.MakeHideable();
        }

        protected override void OnClosed(EventArgs e)
        {
            _selectedRobot.DeleteHideable();
            _createRobot.DeleteHideable();
 //          _openRobot.DeleteHideable();
            _selectedRobot.Close();
            _createRobot.Close();
//            _openRobot.Close();

            base.OnClosed(e);
        }

        private void AdjustPositions(object sender, RoutedEventArgs e)
        {

        }

        private void OpenRobot_Click(object sender, RoutedEventArgs e)
        {
            
            var dlg = new OpenFileDialog { DefaultExt = "xml", Filter = Properties.Resources.XmlResource };
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                OpenRobot _openRobot = new OpenRobot(dlg.FileName); 
                MainWindow.ShowOrHide(_openRobot);
            }
           
        }

        private void OpenSelectedRobot_Click(object sender, RoutedEventArgs e)
        {
            //var window = _selectedRobot;
            MainWindow.ShowOrHide(_selectedRobot);
        }

        private void CreateRobot_Click(object sender, RoutedEventArgs e)
        {
            MainWindow.ShowOrHide(_createRobot);
        }


    }
}
